﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Cloak.NUnit;
using Cloak.Reflection;
using NUnit.Framework;

namespace Ruleweaver.Rules
{
	public class CreateCheckRuleWithArgument : Behavior
	{
		private MethodInfo _method;
		private int _argument;
		private CheckRule _checkRule;

		protected override void Given()
		{
			_method = Reflect.Func<ICheckable<int>, int, Check<int>>(Checkable.IsGreaterThan);
			_argument = 1;
		}

		protected override void When()
		{
			_checkRule = Rule.Check(_method, _argument);
		}

		[Then]
		public void MethodIsOriginal()
		{
			Assert.AreEqual(_method, _checkRule.Method);
		}

		[Then]
		public void ArgumentIsOriginal()
		{
			// TODO: Refactor

			Assert.AreEqual(1, _checkRule.CheckArguments.Count);
			Assert.AreEqual(_argument, (int) _checkRule.CheckArguments.Single());
		}
	}
}